<?php

class Jd_web_month_model extends MY_Model
{

    public function __construct()
    {
        $this->modelename = 'Jd_web_month_model';
        $this->tablename = 'web_month';
        parent::__construct();
    }


    public function addlog($array = array(), $web_id)
    {
        if (!$web_id) {
            $web_id = $this->web_id;
        }
        $DATE = $array['date'];
        $sql = "select id from  jd_web_month where webid=$web_id AND `date`='$DATE'";
        $r = $this->GetBySql($sql, 0);
        if ($r) {
            $array['update'] = time();
            return $r = $this->update($this->tablename, 'id', $r['id'], $array);
        }
        return $r = $this->add($this->tablename, $array);
    }




}
